import Vue from 'vue'
import VueRouter from 'vue-router'



import Layout from '@/views/Layout'
import Home from '@/views/Home'
import Search from '@/views/Search'

Vue.use(VueRouter)

const routes = [
  { path: '/', redirect: '/layout/home' },
  {
    name: 'layout',
    path: '/layout',
    component: Layout,
    children: [
      /* meta:{}可以用来储存数据 */
      { name: 'home', path: 'home', component: Home, meta: { title: '首页' } }, /* 这里的名字不是看组件名字 而是看导入的时候的的名字 */
      { name: 'search', path: 'search', component: Search, meta: { title: '搜索' } },

    ]
  },

]

const router = new VueRouter({
  routes
})

export default router
